package com.xoa.controller.party;

import com.xoa.model.party.SafeConductActivity;
import com.xoa.service.party.SafeActivityService;
import com.xoa.util.common.wrapper.BaseWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by 程叶同 on 2018/1/11.
 */
@Controller
@RequestMapping("safaactivity")
public class SafeActivityController {
    @Autowired
    SafeActivityService safeActivityService;

    @RequestMapping("/addActivity")
    @ResponseBody
    public BaseWrapper addActivity(SafeConductActivity safeConductActivity){
        return  safeActivityService.addActivity(safeConductActivity);
    }

    /**
     * @Author 程叶同
     * @Description 修改
     * @Date 14:49 2018/1/11
     */
    @RequestMapping("/updateActivity")
    @ResponseBody
    public BaseWrapper updateActivity(SafeConductActivity safeConductActivity){
        return  safeActivityService.updateActivity(safeConductActivity);
    }

    /**
     * @Author 程叶同
     * @Description 删除
     * @Date 14:49 2018/1/11
     */
    @RequestMapping("/deleteActivity")
    @ResponseBody
    public BaseWrapper deleteActivity(Integer id){
        return  safeActivityService.deleteActivity(id);
    }


    /**
     * @Author 程叶同
     * @Description 查询单条信息
     * @Date 14:49 2018/1/11
     */
    @RequestMapping("/getActivitysById")
    @ResponseBody
    public BaseWrapper getActivitysById(HttpServletRequest request, Integer id){
        return  safeActivityService.getActivitysById(request,id);
    }


    /**
     * @Author 程叶同
     * @Description 列表展示
     * @Date 14:49 2018/1/11
     */
    @RequestMapping("getList")
    @ResponseBody
    public BaseWrapper getList(HttpServletRequest request, Integer page, Integer pageSize, String startTime, String endTime, String reportUser){
        return  safeActivityService.getList(request,page,pageSize,startTime,endTime,reportUser);
    }

    @RequestMapping("fileOut")
    @ResponseBody
    public BaseWrapper fileOut(HttpServletRequest request, HttpServletResponse response, String ids){
        return  safeActivityService.fileOut(request,response,ids);
    }
}
